<?php
/**
 * 
 */

/**
 * 
 */
abstract class Lite_Collection_AbstractCollection implements LiteCollection {
	
	protected static function unionInto(LiteCollection $into, LiteCollection $c1, LiteCollection $c2) {
		$into->addAll($c1);
		$into->addAll($c2);
		return $into;
	}
	
	/**
	 * @param LiteCollection $col
	 */
	public function addAll(LiteCollection $col){
		foreach($col as $element) {
			$this->add($element);
		}
	}
	
	/**
	 * @param LiteCollection $col
	 * @return boolean
	 */
	public function containsAll(LiteCollection $col){
		foreach($col as $element) {
			if(!$this->contains($element)) {
				return false;
			}
		}
		return true;
	}
	
	/**
	 * @return boolean
	 */
	public function isEmpty(){
		$array = $this->toArray();
		return empty( $array );
	}

	/**
	 * @return int
	 */
	public function size(){
		return count( $this->toArray() );
	}
	
	/**
	 * @return Traversable
	 */
	public function getIterator(){
		return new ArrayIterator( $this->toArray() );
	}
}